More skytraq changes from Mathias.
authorrobertl <robertl>
Sun, 11 Oct 2009 01:39:19 +0000 (01:39 +0000)
committerrobertl <robertl>
Sun, 11 Oct 2009 01:39:19 +0000 (01:39 +0000)
skytraq.c
xmldoc/formats/options/skytraq-baud.xml
xmldoc/formats/options/skytraq-dump-file.xml
xmldoc/formats/options/skytraq-no-output.xml [new file with mode: 0644]
xmldoc/formats/options/skytraq-targetlocation.xml
xmldoc/formats/skytraq.xml

index 607ca4f806af2f083dc0435a62fdef7499917cbd..c6522142893c7e13fabe498ac1991ac708dd41a1 100644 (file)
--- a/skytraq.c
+++ b/skytraq.c
@@ -73,10 +73,10 @@ arglist_t skytraq_args[] = {
          "0", ARGTYPE_BOOL, ARG_NOMINMAX },
        { "targetlocation", &opt_set_location, "Set location finder target location as lat,lng",
          "", ARGTYPE_STRING, "", "" },
+       { "baud", &opt_dlbaud, "Baud rate used for download",
+         "230400", ARGTYPE_INT, "0", "230400" },
        { "initbaud", &opt_initbaud, "Baud rate used to init device (0=autodetect)",
          "0", ARGTYPE_INT, "4800", "230400" },
-       { "baud", &opt_dlbaud, "Baud rate used for download",
-         "230400", ARGTYPE_INT, "4800", "230400" },
        { "read-at-once", &opt_read_at_once, "Number of sectors to read at once (0=use single sector mode)",
          "255", ARGTYPE_INT, "0", "255" },
        { "first-sector", &opt_first_sector, "First sector to be read from the device",
@@ -85,7 +85,7 @@ arglist_t skytraq_args[] = {
          "-1", ARGTYPE_INT, "-1", "65535" },
        { "dump-file", &opt_dump_file, "Dump raw data to this file",
          NULL, ARGTYPE_OUTFILE, ARG_NOMINMAX },
-       { "no-output", &opt_no_output, "Disable output (useful with e.g. erase or targetlocation)",
+       { "no-output", &opt_no_output, "Disable output (useful with erase)",
          "0", ARGTYPE_BOOL, ARG_NOMINMAX },
        ARG_TERMINATOR
 };
@@ -896,10 +896,8 @@ skytraq_read_tracks(void)
                }
        }
 
-       while (read_at_once > 0 && !(buffer = xmalloc(SECTOR_SIZE*read_at_once+sizeof(SECTOR_READ_END)+6))) {
-               read_at_once--;
-       }
-       if (read_at_once == 0) fatal(MYNAME ": Can't allocate buffer for reading\n");
+       buffer = xmalloc(SECTOR_SIZE*read_at_once+sizeof(SECTOR_READ_END)+6);
+       // m.ad/090930: removed code that tried reducing read_at_once if necessary since doesn't work with xmalloc
 
        if (opt_dump_file) {
                dumpfile = gbfopen(opt_dump_file, "w", MYNAME);
@@ -1119,16 +1117,16 @@ skytraq_read(void)
 {
        int dlbaud;
 
+       if (*opt_set_location) {
+               skytraq_set_location();
+               return;
+       }
+
        dlbaud = atoi(opt_dlbaud);
-       if (dlbaud != skytraq_baud) {
+       if (dlbaud != 0  &&  dlbaud != skytraq_baud) {
                skytraq_set_baud(dlbaud);
        }
 
-       if (*opt_set_location) {
-               skytraq_set_location();
-//             return;
-       }
-
        // read device unless no-output=1 and dump-file=0 (i.e. no data needed at all)
        if (*opt_no_output == '0'  ||  opt_dump_file != NULL) {
                skytraq_read_tracks();
@@ -1138,7 +1136,9 @@ skytraq_read(void)
                skytraq_erase();
        }
 
-       skytraq_set_baud(skytraq_baud);         // note that _system_restart resets baud rate anyway...
+       if (dlbaud != 0  &&  dlbaud != skytraq_baud) {
+               skytraq_set_baud(skytraq_baud);         // note that _system_restart resets baud rate anyway...
+       }
        skytraq_system_restart();
 }
 
index 91f4f219a1d434eb694d84f87ff8f2b004a60cec..e250cd78d48f2eb473b0ea3c76e4ae61448a9e25 100644 (file)
@@ -1,3 +1,7 @@
 <para>The following baud rates can be used: 4800, 9600, 19200, 38400, 57600, 115200, 230400.
-Note that your logger might support only a subset of them (especially 230400 which isn't documented
-in the chipset manual, though there are devices that are capable of this speed).</para>
+Note that your logger might not support all of them (especially 230400 which isn't documented
+in the chipset manual, though there are known devices that are capable of this speed).</para>
+
+<para>If <userinput>baud=0</userinput> (zero) download takes place at the baud rate the
+device is currently set to. This is especially useful for Bluetooth connections since they
+often don't allow changing the baud rate.</para>
index 52bb28929915b72a280fd95af98e6128be1993ed..b3323d92b4884bb77facb7f1aa9bd84ab96624e1 100644 (file)
@@ -1,3 +1,3 @@
 <para>Writes raw data as it is read from the logger to the file given as this option's argument
-(additional to decoding it as usual). The binary files can be read and decoded by skytraq-bin format.
+(additional to decoding it as usual). The resulting binary files can be read and decoded by the skytraq-bin format.
 Mainly useful for debugging/development purposes.</para>
diff --git a/xmldoc/formats/options/skytraq-no-output.xml b/xmldoc/formats/options/skytraq-no-output.xml
new file mode 100644 (file)
index 0000000..482aa8c
--- /dev/null
@@ -0,0 +1,2 @@
+<para>If this option is given, no GPS log data will be read from the device
+(unless "dump-file" is given too; in that case only decoding will be disabled).</para>
index 77d5f27466be68d9f7752279b10e13b902b6052e..a132e2ce8d11aa4bf51b98f7e7a9c8b6dff3efef 100644 (file)
@@ -2,13 +2,16 @@
   The device provides a location finder built from eight LEDs and can use
   those LEDs to guide you to a location.  You can set the target location
   with the 'targetlocation' option.  Use ':' as the delimiter between latitude
-  and longitude.
+  and longitude. Note that GPSBabel terminates after writing the location info
+  to the device, i.e. no logging data will be read from it.
 </para>
 <example id="skytraq-targetlocation">
   <title>Set the target location of the Skytraq location finder</title>
   <para>
        <userinput>gpsbabel -i skytraq,targetlocation=12.34:-56.78 -f /dev/ttyUSB
 0 -o unicsv -F -</userinput>
+  </para>
+  <para>
        Sets latitude and longitude of the location finder to N12.34 and 
        W56.78 respectively. 
        The arrows on the device will point you to this location as soon as 
index 0013e3868a04267e98cf639fbfa84e776444037e..cbdab39aa6b0f8e420cd60f814fd617b8baeb79e 100644 (file)
@@ -69,9 +69,10 @@ use this format to read its memory.</para>
 </example>
 
 <para>If available, reading the logger using bluetooth should also work. However, many devices support only one
-specific baud rate over bluetooth, e.g. 9600:</para>
+specific baud rate over bluetooth, e.g. 9600. In that case you should use the option <userinput>baud=0</userinput>
+to tell GPSBabel to use that default baud rate:</para>
 <example id="skytraq-on-linux-bt">
   <title>Command showing skytraq download tracks via bluetooth on Linux</title>
   <para><userinput>rfcomm bind 0 &lt;bdaddr&gt;</userinput></para>
-  <para><userinput>gpsbabel -i skytraq,baud=9600 -f /dev/rfcomm0 -o gpx -F out.gpx</userinput></para>
+  <para><userinput>gpsbabel -i skytraq,baud=0 -f /dev/rfcomm0 -o gpx -F out.gpx</userinput></para>
 </example>